$(document).ready(function() {
	var track_load = 0; //total loaded record group(s)
	var loading  = false; //to prevents multipal ajax loads
	var total_groups = 10; //total record group(s)
	var byID = "latestcomedy";
	$(window).scroll(function() { //detect page scroll
	var doheight = $(document).height();
		if($(window).scrollTop() + $(window).height() > 1800)  //user scrolled to bottom of the page?
		{
          var messages = ["http://www.sabbaymerl.com/feeds/posts/default"];

          var idrandom = getMessage(messages);
          var rss1 = idrandom+'?max-results=6';
		  var loadbylatestcomedy = $('#loadbylatestcomedy').val();
		  if(loadbylatestcomedy !=1){
          	loadrssbyfeed(rss1, byID,'_blank');
          }

          var moviesload = ["http://www.sabbaymerl.com/feeds/posts/default/-/Movies"];
          var id_moves = getMessage(moviesload);
          var rss2 = id_moves+'?max-results=6';
          var byID2 =  "latestmovies";
		  var loadbylatestmovies = $('#loadbylatestmovies').val();
		  if(loadbylatestmovies !=1){
          	loadrssbyfeed(rss2, byID2,'_blank');
          }
        }
	});
});
function getMessage(randid) {
   return randid[Math.floor(Math.random() * randid.length)];
}

/*function ADS*/

function showAds(){
	if(ShowAD) {
		$("#ads1 *").hide();
		$("#ads2 *").hide();
		$("#ads3 *").hide();
		$("#static-ad *").hide();
		//$("#ShowSidebarR *").hide();
		
		var div1 = $('<div>');
		$("#ads1").html(div1);
		var div2 = $('<div>');
		$("#ads2").html(div2);
		var div3 = $('<div>');
		$("#ads3").html(div3);
		var div4 = $('<div>');
		$("#static-ad").html(div4);
		var div5 = $('<div>');
		$("#ShowSidebarR").append(div5);
				  var widthad = 300;
				 postscribe(div1,'<style>.respondsive-ad-top { width: 300px; height: 250px;}.play-ads div{margin-bottom:20px;}@media(min-width: 1440px) { .respondsive-ad-top { width: 300px; height: 250px; }}@media(min-width: 1540px) { .respondsive-ad-top { width: 300px; height: 250px; }}@media only screen and (min-width:768px) and (max-width:1439px) {.respondsive-ad-top {width: 300px; height: 250px; } }@media(max-width: 468px) { .respondsive-ad-top { width: 320px; height: 50px;  }}.respondsive-ad-related { width: 728px; height: 90px;}@media(min-width: 781px) { .respondsive-ad-related { width: 728px; height: 90px; }}@media(min-width: 970px) { .respondsive-ad-related { width: 728px; height: 90px;}}@media only screen and (min-width:728px) and (max-width:989px) {.respondsive-ad-related {width: 728px; height: 90px; } }@media only screen and (min-width:468px) and (max-width:767px) {.respondsive-ad-related {width: 468px; height: 60px; } }@media(max-width: 468px) { .respondsive-ad-related { width: 320px; height: 50px;  }} .respondsive-ad-sidebar { width: 160px; height: 600px;}@media(min-width: 781px) { .respondsive-ad-sidebar { width: 160px; height: 600px; }}@media(min-width: 970px) { .respondsive-ad-sidebar { width: 160px; height: 600px;}}@media only screen and (min-width:728px) and (max-width:989px) {.respondsive-ad-sidebar {width: 600px; height: 600px; } }@media only screen and (min-width:468px) and (max-width:767px) {.respondsive-ad-sidebar {width: 300px; height: 250px; } }@media(max-width: 468px) { .respondsive-ad-sidebar { width: 320px; height: 50px;  }}.respondsive-ad-sidebar-r { width: 300px; height: 600px;}@media(min-width: 781px) { .respondsive-ad-sidebar-r { width: 300px; height: 600px; }}@media(min-width: 970px) { .respondsive-ad-sidebar-r { width: 300px; height: 600px;}}@media only screen and (min-width:728px) and (max-width:989px) {.respondsive-ad-sidebar-r {width: 300px; height: 600px; } }@media only screen and (min-width:468px) and (max-width:767px) {.respondsive-ad-sidebar-r {width: 300px; height: 600px; } }@media(max-width: 468px) { .respondsive-ad-sidebar-r { width: 320px; height: 50px;  }#static-ad{position: fixed;bottom: 85px;z-index:9999;left:3px}}<\/style><script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"><\/script><ins class="adsbygoogle respondsive-ad-top" style="display:inline-block" data-ad-client="ca-pub-'+ads_id+'" data-color-border="ffffff" data-color-bg="ffffff" data-color-link="0b5394" data-color-text ="333333" data-color-url="0b5394"><\/ins><script>(adsbygoogle = window.adsbygoogle || []).push({});<\/script>');
				 postscribe(div2,'<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"><\/script><ins class="adsbygoogle respondsive-ad-top" style="display:inline-block" data-ad-client="ca-pub-'+ads_id+'" data-color-border="ffffff" data-color-bg="ffffff" data-color-link="0b5394" data-color-text ="333333" data-color-url="0b5394"><\/ins><script>(adsbygoogle = window.adsbygoogle || []).push({});<\/script>');
				 postscribe(div3,'<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"><\/script><ins class="adsbygoogle respondsive-ad-related" style="display:inline-block" data-ad-client="ca-pub-'+ads_id+'" data-color-border="ffffff" data-color-bg="ffffff" data-color-link="0b5394" data-color-text ="333333" data-color-url="0b5394"><\/ins><script>(adsbygoogle = window.adsbygoogle || []).push({});<\/script>');
				 postscribe(div4,'<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"><\/script><ins class="adsbygoogle respondsive-ad-sidebar" style="display:inline-block" data-ad-client="ca-pub-'+ads_id+'" data-color-border="ffffff" data-color-bg="ffffff" data-color-link="0b5394" data-color-text ="333333" data-color-url="0b5394"><\/ins><script>(adsbygoogle = window.adsbygoogle || []).push({});<\/script><script src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-53afce5354abe9ad" type="text/javascript"><\/script>');
				 //postscribe(div5,'<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"><\/script><ins class="adsbygoogle respondsive-ad-sidebar-r" style="display:inline-block" data-ad-client="ca-pub-'+ads_id+'" data-color-border="ffffff" data-color-bg="ffffff" data-color-link="0b5394" data-color-text ="333333" data-color-url="0b5394"><\/ins><script>(adsbygoogle = window.adsbygoogle || []).push({});<\/script><script src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-53afce5354abe9ad" type="text/javascript"><\/script>');
	}
}
/*end function sohw ads*/
var labelSidebar1 = 'http://mhetkar.blogspot.com/feeds/posts/default/-/Entertainment?max-results=5';
var labelSidebar2 = 'http://mhetkar.blogspot.com/feeds/posts/default/-/Khmer News?max-results=5';